<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>823680621@qq.com</title>
    <style>
        #canvas{
            border: 1px solid #000000;
            display: block;
            margin: 50px auto;
        }
    </style>
</head>
<body>
    <canvas id="canvas" width="800" height="400">
        当前浏览器不支持canvas
    </canvas>
</body>
<script>
    let canvas = document.getElementById('canvas')
    let context = canvas.getContext('2d')
    //绘制矩形
    context.beginPath()
    context.rect(200,20,100,100)
    context.fillStyle="#00f"
    context.fill()

    context.globalCompositeOperation = "source-over" //覆盖


    //绘制圆
    context.beginPath()
    context.arc(320,120,60,0,2*Math.PI,false)
    context.fillStyle = "#f00"
    context.fill()

</script>
</html>